//  Tester for scanner
//  main.c
//  Scanner
//
//  Created by Pei Liu on 10/4/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include "lex.yy.c"

int main (int argc, const char * argv[])
{
    //initialization
    strlist = malloc(SIZE * sizeof(char));
    
    //set file in
    if (!(yyin = fopen(argv[1], "r"))) 
    {
        printf("INVALID FILE!");
        exit(0);
    }
    
    //Loop until get end
    int i = yylex();
    while (i)
    {
        printf("TOKEN: %d\n", i);
        i = yylex();
    }
    
    //print stringlist
    printf("String List: \n");
    for(i = 0; i < strNbr; i++)
        printf("%d:\t%s\n", i,strlist[i]);
    
    return 0;
}

